package number_41;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class Solution {
    public int firstMissingPositive(int[] nums) {
        Set<Integer> set = new HashSet<>();

        for (int v : nums ) {
            set.add(v);
        }
        int res = 1;
        while (true) {
            if (set.contains(res)) {
                res++;
            } else {
                return res;
            }
        }

    }
}
